home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Tool Chest / Dev.CD Aug 98 TC.toast / Tool Chest / Testing & Debugging / Mac OS Development Toolkit / Automation Essentials 2.3.0 / • Other Stuff / Scripting Aids / VUMark < prev   
Encoding:
Text File  |  1998-03-19  |  2.8 KB  |  102 lines  |  [TEXT/MPS ]

  1. ## VUMark - a script by NJV designed to mark tasks in VU scripts.
  2. ##
  3. ## Usage:    To use VUMark, just put this script into the MPW Scripts folder (or somewhere
  4. ##            where MPW can find it) and type the following line from the worksheet:
  5. ##
  6. ##                VUMark theScriptName
  7. ##
  8. ##            where theScriptName is the name (and path, if not in current directory) of
  9. ##            the VU script to be marked.  If you do not wish the file to be closed after
  10. ##            being marked, use the following syntax:
  11. ##
  12. ##                VUMark -nc theScriptName
  13. ##
  14. ## Examples -    VUMark -nc myScript.vu
  15. ##                VUMark myScript.vu
  16. ##
  17. ## 10/5/90 - created version 1.0a1
  18. ## 10/6/90 - Now ignores case and will find task names with _ in them.  Any other characters
  19. ##             that need to be included, please let me know.  - Nick x44278
  20. ## 04/11/93 - ∂r changed to ∂n in task search - SBR
  21. ## 05/21/93 - script object mark added for VU 2.x scripts - SBR
  22. ## 05/21/93 - returns marked script to the front - SBR
  23. ##
  24. set Version "1.0b1"
  25. set exit 0
  26.  
  27. if ({#} == 0)
  28.     echo
  29.     echo "## {0} Version {Version} - by NJV"
  30.     echo "##"
  31.     echo "## Desc. -    {0} will search the requested file for the literal string ∂"Task∂" at"
  32.     echo "##            the beginning of a line and will mark that location with the task name "
  33.     echo "##            (the word following the task string). When all the tasks are marked, "
  34.     echo "##          {0} will search the requested file for the literal string ∂"Script∂" "
  35.     echo "##          and mark that location with ••{scriptName}••. Once the marking is done, "
  36.     echo "##            the file is saved. If the -nc parameter is not present, the file is closed, "
  37.     echo "##            otherwise it is returned to the front. "
  38.     echo "## Usage:"
  39.     echo "## {0} [-nc] ∂"vuScriptName∂""
  40.     echo "##"
  41.     echo "##        -nc                -    Optional parameter - if present, VUMark will not close (nc)"
  42.     echo "##                            the script after marking it."
  43.     echo "##        vuScriptName    -    The name of the VU script to be marked"
  44.     echo "##"
  45.     echo "## Example:"
  46.     echo "##        {0} ∂"myScript.vu∂""
  47.     echo "##        {0} -nc ∂"myScript.vu∂""
  48.     echo "##"
  49.     exit 1
  50. end
  51.  
  52.  
  53. Set CloseFile 1
  54. if "{1}" =~ /-nc/
  55.     set CloseFile 0
  56.     Target "{2}"
  57. else
  58.     Target "{1}"
  59. end
  60.  
  61. Set oldWrap {SearchWrap}
  62. Set SearchWrap 0
  63. Set oldType {SearchType}
  64. Set SearchType 0
  65. Set oldBack {SearchBackward}
  66. Set SearchBackward 0
  67. Set oldCase {CaseSensitive}
  68. Set CaseSensitive 0
  69.  
  70. Find • "{Target}"
  71.  
  72. loop
  73.     Find /•task[ ∂n∂t]*/ "{Target}"
  74.     Break if {status} == 2
  75.     Find /[A-Za-z_0-9]+/ "{Target}"
  76.     Set tempName "`Catenate "{Target}".§`";
  77.     Mark -y § "{tempName}" "{Target}"
  78. End
  79.  
  80. Find • "{Target}"
  81.  
  82. loop
  83.     Find /•script[ ∂n∂t]*/ "{Target}"
  84.     Break if {status} == 2
  85.     Find /[A-Za-z_0-9]+/ "{Target}"
  86.     Set tempName "`Catenate "{Target}".§`";
  87.     Mark -y § "••{tempName}••" "{Target}"
  88. End
  89.  
  90. Save "{Target}"
  91.  
  92. if {CloseFile}
  93.     Close "{Target}"
  94. else
  95.     Open "{target}"
  96. end
  97.  
  98. Set SearchWrap {oldWrap}
  99. Set SearchType {oldType}
  100. Set SearchBackward {oldBack}
  101. Set CaseSensitive {oldCase}
  102.